import React, { memo, ReactNode, FC } from "react";
import { useAppSelector, appShallowEqual, useAppDispatch } from "@/stores/index";
import { changeCounter } from "@/stores/modules/counter";
interface IProps {
  children?: ReactNode;
}

const Download: FC<IProps> = memo((props) => {
  const { msg } = useAppSelector(
    (state) => ({
      msg: state.counter.msg,
    }),
    appShallowEqual
  );
  const dispatch = useAppDispatch();
  function changeMsg() {
    dispatch(changeCounter("cccc"));
  }
  return (
    <div>
      Download-{msg}
      <button onClick={changeMsg}>11111111</button>
    </div>
  );
});

export default Download;
